<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_CodeFunc.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: do ::</title>
</head>
<body>
<!-- header start -->
<? include("../_layout/head.inc"); ?>
<!-- header end -->
<?
	$seq = $param->getNumber('seq');
	$mode = $param->getString('mode');
	$order_code = $param->getString('order_code');
	$tseq = $param->getString('tseq');
	$tradenum = $param->getString('tradenum');
	$trade_date = $param->getString('trade_date');
	$trade_price = $param->getNumber('trade_price');
	$trade_arrivaldate = $param->getString('trade_arrivaldate');
	$trade_arrivaltime = $param->getString('trade_arrivaltime');

	if ($mode == "w")
	{
		if ($seq=="" || $tseq=="" || $tradenum=="" || $trade_date=="" || $trade_price=="" || $trade_arrivaldate=="" || $trade_arrivaltime=="")
		{
			jserror("입력값을 확인해주세요.","document.location='about:blank'");
			return;
		}
		for($i=0;$i<sizeof($tseq);$i++)
		{
			$article_arr = array(
				'PRODUCT_SEQ' => $tseq[$i],
				'ORDER_CODE' => $order_code,
				'TRADE_NUMBER' => $tradenum[$i],
				'TRADE_PRICE' => $trade_price,
				'TRADE_ARRIVALDATE' => $trade_arrivaldate,
				'TRADE_ARRIVALTIME' => $trade_arrivaltime,
				'TRADE_DATE' => $trade_date,
			);
			$no = Trade_InsertArticle($article_arr);
			if ($no == -1)
			{
				jserror("등록중 오류가 발생했습니다.","document.location='about:blank'");
				return;
			}
		}
		if ($no == -1)
		{
			jserror("등록중 오류가 발생했습니다.","document.location='about:blank'");
			return;
		}
		else
		{
			cacheControl(0);
			// 출력 버퍼를 비운다.
			ob_clean();
			jserror("등록되었습니다.","parent.fnclose()");
		}
	}
?>
</body>
</html>